package biblio;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;


@Entity
@NamedQuery(name="allbooks",query="select b.title from Book AS b")
public class Book implements Serializable {

	private static final long serialVersionUID = 1L;
	private Long id;
	private String author;
	private String title;

	public Book() {}
	
	public Book(String author, String title) {
	
		this.author = author; this.title = title;
	}
	
	
	public String getAuthor() { return author; }
	
	public void setAuthor(String author) { this.author = author;}
	
	public String getTitle() { return title; }
	
	public void setTitle(String title) { this.title = title; }
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() { return id; }
	
	public void setId(Long id) { this.id = id; }
	
	@Override
	public int hashCode() { int hash=0; hash+=(id!=null ? id.hashCode():0);
	
	return hash;}
	
	@Override
	public boolean equals(Object object) {
		if (!(object instanceof Book))return false; Book other=(Book) object;
		if((this.id==null && other.id!=null)||(this.id!=null &&
				!this.id.equals(other.id))) return false;
		return true;}
}